/*
 * 原版接口
 */
import * as server from "@minecraft/server";

/**
 * * 虚空方块 触发器
 */
export function UnrealSpaceTrigger(): server.BlockCustomComponent {
    return {
        beforeOnPlayerPlace(source: server.BlockComponentPlayerPlaceBeforeEvent) {
            source.permutationToPlace = source.permutationToPlace.withState('STATE:stage', 1)
        }
    }
};
/**
 * * 魔导总线 触发器
 */
export function MagicCableTrigger(): server.BlockCustomComponent {
    return {
        beforeOnPlayerPlace(source: server.BlockComponentPlayerPlaceBeforeEvent) {
            source.permutationToPlace = source.permutationToPlace.withState('STATE:stage', false)
        }
    }
};
/**
 * * 从林木椅 触发器
 */
export function JungleWoodChairTrigger(): server.BlockCustomComponent {
    return {
        beforeOnPlayerPlace(source: server.BlockComponentPlayerPlaceBeforeEvent) {
            source.permutationToPlace =
                source.player?.isSneaking
                    ? source.permutationToPlace.withState('STATE:type', 1)
                    : source.permutationToPlace.withState('STATE:type', 0)
        }
    }
};